home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8007 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.6 KB  |  118 lines

  1. Path: news.ping.at!usenet
  2. From: Andreas Schwab <andycom@ping.at>
  3. Newsgroups: comp.lang.c++
  4. Subject: Help: How can I use Delphi-DLLs with BC++? It doesn't work as documented!
  5. Date: Sat, 17 Feb 1996 15:16:52 +0100
  6. Organization: ping - Personal InterNet Gate
  7. Message-ID: <3125E354.99@ping.at>
  8. NNTP-Posting-Host: e234.ping.at
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  13.  
  14. I have the following problem: I want to use a Delphi 1.0-DLL (includes a 
  15. form) with Borland C++ 4.5 but it doesn't work. I allways get the 
  16. following error-message:
  17.  
  18. Linker Error: Undefinde symbol readvalue() in module DLLTEST.CPP
  19.  
  20. Could anybody help me and tell me what the problem is? Maybe you could 
  21. tell me where I can find a program which uses a Delphi-DLL or otherwise 
  22. what do I make wrong?
  23.  
  24. Thanks a lot, Andreas Schwab
  25.  
  26. ---------------------------
  27. Here is my program and after it the def-file:
  28.  
  29. CPP-Datei:
  30. /*
  31. program:                dlltest
  32. language:       borland c++
  33. compiler:         bc 4.5
  34. operating sys.: windows 16 Bit
  35. tested:         windows 95
  36. author:         schwab andreas
  37. date:           1996-02-17
  38. action:         beispielprogramm zum einbinden einer delphi-dll
  39. release:                1.0
  40. */
  41. #include <owl\owlpch.h>
  42. #include <owl\applicat.h>
  43. #include <owl\framewin.h>
  44. #include <stdlib.h>
  45. #include <c:\datas\bc45\dlltest\dlltest.rc>
  46.  
  47. int FAR PASCAL ReadValue();
  48.  
  49. class TDLLWindow: public TWindow
  50. {
  51.     public:
  52.         TDLLWindow(TWindow* parent = 0);
  53.     protected:
  54.         BOOL DBRun;
  55.         void CmTest();  // botschaftsbeantwortungsfunktionen
  56.         void CmExit();
  57.         void CmAbout();
  58.         DECLARE_RESPONSE_TABLE(TDLLWindow);
  59. };
  60.  
  61. DEFINE_RESPONSE_TABLE1(TDLLWindow, TWindow)
  62.     EV_COMMAND(CM_TEST, CmTest),
  63.     EV_COMMAND(CM_EXIT, CmExit),
  64.     EV_COMMAND(CM_ABOUT, CmAbout),
  65. END_RESPONSE_TABLE;
  66.  
  67. /*
  68. constructor:        tdllwindow::tdllwindow
  69. task:                        instantiiert tdllwindow
  70. */
  71. TDLLWindow::TDLLWindow(TWindow* parent)
  72. {
  73.     Init(parent, 0, 0);  // instantiiert das fenster
  74. }
  75.  
  76. void TDLLWindow::CmTest()
  77. {
  78.     int valueI;
  79.     valueI = 1;
  80.     ReadValue();
  81.     //MessageBox("Feature not implemented", "Test", MB_OK);
  82. }
  83.  
  84. void TDLLWindow::CmExit()
  85. {
  86.     MessageBox("Feature not implemented", "Exit", MB_OK);
  87. }
  88.  
  89. void TDLLWindow::CmAbout()
  90. {
  91.     MessageBox("Feature not implemented", "About", MB_OK);
  92. }
  93.  
  94. class TMyApp: public TApplication
  95. {
  96.     public:
  97.         TMyApp():    TApplication() {}
  98.         void InitMainWindow();
  99. };
  100.  
  101. void TMyApp::InitMainWindow()
  102. {
  103.     SetMainWindow(new TFrameWindow(0, "DLL Test", new TDLLWindow));
  104.     GetMainWindow()->AssignMenu("COMMANDS");
  105. }
  106.  
  107. int OwlMain(int /*argc*/, char* /*argv*/ [])
  108. {
  109.     return TMyApp().Run();
  110. }
  111.  
  112. DEF-file:
  113. IMPORTS
  114.     ReadValue=DELPHDLL.ReadValue
  115.  
  116. STACKSIZE 6144
  117.  
  118.